<?php
require_once ("../db/connectdatabase.php");

function insertRateObjectLoan($id, $idproduct, $idbank, $rate1, $rate2) {
	$con = new ConnectDB();
	$tbl = "loan_rate_for_product_basic";
	$fn = array('basic_id' => $id, 'prkey' => $idproduct, 'bankid' => $idbank, 'basic_rate1' => $rate1, 'basic_rate2' => $rate2, 'datecreate' => $id);
	return $con -> insert($tbl, $fn);
}

function updateRateObjectLoan($id, $idproduct, $idbank, $rate1, $rate2) {
	$con = new ConnectDB();
	$tbl = "loan_rate_for_product_basic";
	$fn = array('prkey' => $idproduct, 'bankid' => $idbank, 'basic_rate1' => $rate1, 'basic_rate2' => $rate2, 'datecreate' => time());
	$condition = array('basic_id' => $id);
	return $con -> update($tbl, $fn, $condition);
}

function updateDisplayRateObjectLoan($id, $use) {
	$con = new ConnectDB();
	$tbl = "loan_rate_for_product_basic";
	$fn = array('basic_isuse' => $use, 'datecreate' => time());
	$condition = array('basic_id' => $id);
	return $con -> update($tbl, $fn, $condition);
}

function deleteRateObjectLoan($id) {
	$con = new ConnectDB();
	$tbl = "loan_rate_for_product_basic";
	$condition = array('basic_id' => $id);
	return $con -> delete($tbl, $condition);
}

?>